package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 批改任务优先级枚举
 *
 * @author System
 * @version 2.0.0
 * @since 2025-11-11
 */

public enum CorrectionTaskPriority implements BaseEnum {
    LOW("Low", "低优先级"),
    NORMAL("Normal", "普通优先级"),
    HIGH("High", "高优先级"),
    URGENT("Urgent", "紧急");

    private final String code;
    private final String description;

    CorrectionTaskPriority(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static CorrectionTaskPriority fromCode(String code) {
        for (CorrectionTaskPriority priority : values()) {
            if (priority.getCode().equals(code)) {
                return priority;
            }
        }
        throw new IllegalArgumentException("Unknown correction task priority code: " + code);
    }

    public static CorrectionTaskPriority fromDescription(String description) {
        for (CorrectionTaskPriority priority : values()) {
            if (priority.getDescription().equals(description)) {
                return priority;
            }
        }
        throw new IllegalArgumentException("Unknown correction task priority description: " + description);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}